package com.w3coffee.web;

import com.w3coffee.web.dao.model.TUser;

public class User {
	/** 持久化对象（Persistence Object）*/
	private TUser po;
	
	private Object authAgent;
	private Object requestToken;
	private Object accessToken;
	
	public User() {
		clear();
		po = new TUser();
	}
	
	public User(TUser tu) {
		this.po = tu;
	}
	
	public TUser getPo() {
		return po;
	}

	public void clear() {
		authAgent = null;
		requestToken = null;
		accessToken = null;
	}

	public boolean isValid() {
		if (po == null) {
			return false;
		} else {
			return po.getUid() != null;
		}
	}

	public Object getAuthAgent() {
		return authAgent;
	}

	public void setAuthAgent(Object authAgent) {
		this.authAgent = authAgent;
	}

	public Object getRequestToken() {
		return requestToken;
	}

	public void setRequestToken(Object requestToken) {
		this.requestToken = requestToken;
	}

	public Object getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(Object accessToken) {
		this.accessToken = accessToken;
	}

	public boolean equals(Object obj) {
		return po.equals(obj);
	}

	public Integer getUid() {
		return po.getUid();
	}

	public String getId() {
		return po.getId();
	}

	public String getName() {
		return po.getName();
	}

	public String getHost() {
		return po.getHost();
	}

	public String getIntro() {
		return po.getIntro();
	}

	public Boolean getVip() {
		return po.getVip();
	}

	public Integer getFansNum() {
		return po.getFansNum();
	}

	public String getHeadUrl() {
		return po.getHeadUrl();
	}

	public String getToken() {
		return po.getToken();
	}

	public String getVerifier() {
		return po.getVerifier();
	}

	public int hashCode() {
		return po.hashCode();
	}

	public void setUid(Integer uid) {
		po.setUid(uid);
	}

	public void setId(String id) {
		po.setId(id);
	}

	public void setName(String name) {
		po.setName(name);
	}

	public void setHost(String host) {
		po.setHost(host);
	}

	public void setIntro(String intro) {
		po.setIntro(intro);
	}

	public void setVip(Boolean vip) {
		po.setVip(vip);
	}

	public void setFansNum(Integer fansNum) {
		po.setFansNum(fansNum);
	}

	public void setHeadUrl(String headUrl) {
		po.setHeadUrl(headUrl);
	}

	public void setToken(String token) {
		po.setToken(token);
	}

	public void setVerifier(String verifier) {
		po.setVerifier(verifier);
	}

	public String toString() {
		return po.toString();
	}
	
	public String getPhotoUrl() {
		String host = getHost();
		if ("qq".equals(host)) {
			return getHeadUrl() + "/40";
		} else if ("sina".equals("host")) {
			return getHeadUrl();
		} else {
			return "";
		}
	}
}
